package com.payfen.client.jsonbean;

import java.util.HashMap;
import java.util.Map;

public class ResultBean {
	private Map result;
	private Map resultHead;
	private Map resultBody;

	public Map getResult() {
		return result;
	}

	private Map getResult(Map resultHead,Map resultBody) {
		this.result = new HashMap();
		this.result.put("resultBody",resultBody);
		this.result.put("resultHead",resultHead);
		return this.result;
	}

	private Map getResultHead(String resultCode,String message) {
		this.resultHead = new HashMap();
		this.resultHead.put("resultCode", resultCode);
		this.resultHead.put("message", message);
		return this.resultHead;
	}

	private Map getResultBody(Object object) {
		this.resultBody = new HashMap();
		this.resultBody.put("body", "");
		return this.resultBody;
	}
	
	public static String createReturnJson(String code,String message,Object bodyObject){
		ResultBean rb = new ResultBean();
		Map head = rb.getResultHead(code, message);
		Map body = rb.getResultBody(bodyObject);
		return net.sf.json.JSONArray.fromObject(rb.getResult(head,body)).toString();
	}
	
	public static void main(String arg[]){
		System.out.println(ResultBean.createReturnJson("0000", "成功",null));
	}
}
